package masml2jade.agents;

import jade.core.Agent;
import jade.core.behaviours.Behaviour;

import java.util.Hashtable;

import masml2jade.AgentRole;
import masml2jade.Environment;

public class MAS_Agent extends Agent {
	
	private Hashtable<String, AgentRole> agentRoles = new Hashtable<String, AgentRole>();
	private Environment environment ;
	
	protected MAS_Agent(Environment environment, AgentRole agentRole) {
		this.environment = environment;
		agentRoles.put(agentRole.getName(), agentRole);
	}
	
	// Environment
	public Environment getEnvironment() {
		return environment;
	}
	public void setEnvironment(Environment environment) {
		this.environment = environment;
	}
	
	// AgentRoles
	public AgentRole getAgentRole(String name) {
		return agentRoles.get(name);
	}
	public void addAgentRole(String name, AgentRole role) {
		agentRoles.put(name, role);
	}
	public AgentRole removeAgentRole(String name) {
		return agentRoles.remove(name) ;
	}
	public void removeAllAgentRoles() {
		agentRoles.clear();
	}
	public Hashtable<String, AgentRole> getAllAgentRoles() {
		return agentRoles;
	}

	// Put agent initializations here
	protected void setup() {
		super.setup();
		this.setEnabledO2ACommunication(true, 0);

		// Ambiente
		this.getAID().getName(); // PlatformID

		// Organiza��o
		this.getAID().getName(); // ContainerID

		// Papel de Agente (muda cren�as e objetivos dos agentes)
		// Algum behaviour

		// Agente Reativo simples, possui somente comportamento

	}

	// Put agent clean-up operations here
	protected void takeDown() {

	}
	
}
